define([ "Zepto", "underscore", "Backbone", "Handlebars",
         "views/teacher/courseoptionview"
         ], function($, _, Backbone, Handlebars, CourseOptionView) {

	var CoursesInputView = Backbone.View.extend({


		initialize : function() {
			this.model.bind("reset", this.render, this);
		},

		render : function(eventName) {
			
			$(this.el).empty();
		
			_.each(this.model.models,
				function(course) {
					﻿$(this.el).append(new CourseOptionView({
						tagName : 'option',
						attributes: {
							'value' : course.get('objectId')
						},
						 model : course
					}).render().el);
				 },
				 this);
			
            $('.course').scroller({
            	 preset: 'select',
 	            theme: 'android-ics light',
 	            display: 'modal',
 	            mode: 'scroller'
            });
		}

	});
	

	return CoursesInputView;
});
